package com.walker.weixin.entity.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.walker.weixin.entity.BaseMessage;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @Description: 图文消息
 * @ProjectName: wms_step
 * @Package: com.walker.weixin.entity.message
 * @ClassName: NewsMessage
 * @Author: yangyl
 * @CreateDate: 2020-07-20 16:45
 */
@XStreamAlias("xml")
public class NewsMessage extends BaseMessage implements Serializable {

    @XStreamAlias("ArticleCount")
    private Integer articleCount;
    @XStreamAlias("Articles")
    private List<Article> articles;

    public NewsMessage(Map<String, Object> requestMap, List<Article> articleList) {
        super(requestMap, "news");
        this.articles = articleList;
        this.articleCount = articleList != null ? articleList.size() : 0;
    }


    @XStreamAlias("item")
    public static class Article implements Serializable {

        @XStreamAlias("Title")
        private String title;  //标题
        @XStreamAlias("Description")
        private String description;  //描述
        @XStreamAlias("PicUrl")
        private String picUrl;  //图片地址
        @XStreamAlias("Url")
        private String url;  //点击图文消息跳转链接

        public Article(String title, String description, String picUrl, String url) {
            this.title = title;
            this.description = description;
            this.picUrl = picUrl;
            this.url = url;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getPicUrl() {
            return picUrl;
        }

        public void setPicUrl(String picUrl) {
            this.picUrl = picUrl;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }

    public Integer getArticleCount() {
        return articleCount;
    }

    public List<Article> getArticles() {
        return articles;
    }

    public void setArticles(List<Article> articles) {
        this.articles = articles;
    }
}
